package com.haisen.lee.serviceimpl;

import java.net.URL;

import org.w3c.dom.Node;

import com.haisen.lee.domain.FormDictionary;
import com.haisen.lee.service.IDomParserThread;

public class FormDomParserThreadImpl implements IDomParserThread {

	private Node formNode;
	private URL searchWebSite;
	private URL actionUrl;
	

	

	private FormDictionary formDictionary;
	private double formWeight;
	

	@Override
	public void setParserNode(Node root) {
		this.formNode = root;
	}

	@Override
	public void setUrl(URL url) {
		this.searchWebSite = url;
	}

	@Override
	public void run() {
		FormDomParserImpl formDomParserImpl = new FormDomParserImpl();
		formDomParserImpl.setFormDictionary(formDictionary);
		formDomParserImpl.setUrl(searchWebSite);
		formDomParserImpl.contentExtractor(formNode);
		formWeight = formDomParserImpl.getFormWeight();
		actionUrl = formDomParserImpl.getActionUrl();
		
	}
	
	public double getFormWeight() {
		return formWeight;
	}

	@Override
	public void setFormDictionary(FormDictionary formDictionary) {
		this.formDictionary = formDictionary;
	}
	
	public URL getActionUrl() {
		return actionUrl;
	}

}
